/*
 * @Author: yx_ning
 * @Description:
 * @File: main
 * @Version: 1.0.0
 * @Date: 22/12/2023 上午10:47
 */
package main

import (
	"gin-simple/core"
	"gin-simple/global"
	initialize "gin-simple/init"
	"go.uber.org/zap"
)

func main() {

	global.VP = core.Viper() // 初始化Viper
	initialize.OtherInit()
	global.LOG = core.Zap() // 初始化zap日志库
	zap.ReplaceGlobals(global.LOG)

	global.Trans = initialize.InitTrans()
	global.Validate = initialize.InitValidate()

	global.DB = initialize.Gorm() // gorm连接数据库
	initialize.Timer()
	initialize.DBList()
	if global.DB != nil {
		initialize.RegisterTables() // 初始化表
		// 程序结束前关闭数据库链接
		db, _ := global.DB.DB()
		defer db.Close()
	}
	core.RunWindowsServer()
}
